
#include <stdio.h>

#include <unistd.h>

#include <sys/time.h>
#include <sys/resource.h>

/*
    文件描述符的介绍
*/

int get_file_max()
{
    struct rlimit limit;
    if (getrlimit(RLIMIT_NOFILE, &limit) == -1)
    {
        fprintf(stderr, "getrlimit error!\n");
        return -1;
    }
    return (int)limit.rlim_cur;
}

int main(void)
{
    printf("Standard input %d\n", STDIN_FILENO);
    printf("Standard output %d\n", STDOUT_FILENO);
    printf("Standard Error %d\n", STDERR_FILENO);

    printf("OPEN_MAX %d\n", get_file_max());

    return 0;
}